import request from "@/utils/request";

export function getEmployees(params) {
  return request({
    url: "/sys/user",
    method: "get",
    params
  });
}

/* 新增员工 */
export function addEmployees(data) {
  return request({
    url: "/sys/user",
    method: "post",
    data
  });
}

/** *
 *  封装一个导入员工的接口
 *
 * ***/

export function importEmployeeApi(data) {
  return request({
    url: "/sys/user/batch",
    method: "post",
    data
  });
}

/** *
 *  读取用户详情的基础信息
 * **/
export function getPersonalDetailApi(id) {
  return request({
    url: `/employees/${id}/personalInfo`
  });
}


/** *
 *  更新用户详情的基础信息
 * **/
export function updatePersonalApi(data) {
  return request({
    url: `/employees/${data.userId}/personalInfo`,
    method: 'put',
    data
  })
}

//  保存员工基本信息
/** *
 *
 * 保存员工的基本信息
 * **/
export function saveUserDetailByIdApi(data) {
  return request({
    url: `/sys/user/${data.id}`,
    method: "put",
    data
  });
}




/** **
 * 获取用户的岗位信息
 *
 * ****/
export function getJobDetailApi(id) {
  return request({
    url: `/employees/${id}/jobs`
  })
}
